FROM golang:1.17 AS build

WORKDIR /build

COPY . .

ENV GOPROXY=https://goproxy.cn,direct
ENV GO111MODULE=on

RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o app main.go

FROM scratch

COPY --from=build /build/app /app

ENV VERSION=v1

ENTRYPOINT ["/app"]